#include<stdio.h>
#define N 20
void CalculateYH(int a[][N], int n);
void PrintYH(int a[][N], int n);
int main(void)
{
	int a[N][N] = { 0 }, n;
	printf("Input n(n<20):");
	scanf_s("%d", &n);
	CalculateYH(a, n);
	PrintYH(a, n);
	return 0;
}
void CalculateYH(int a[][N], int n)
{
	int i, j;
	for (i = 0; i < n; i++)
	{
		for (j = 0; j < n; j++)
		{
			if (j == 0 || i == j)
			{
				a[i][j] = 1;

			}
			else
			{
				a[i][j] = a[i - 1][j - 1] + a[i - 1][j];
			}
		}
	}
}
void PrintYH(int a[][N], int n)
{
	int i, j;
	for (i = 0; i < n; ++i)
	{
		for (j = n - i; j > 0; --j)
		{
			printf("   ");
		}
		for (j = 0; j <= i; ++j)
		{
			printf("%6d", a[i][j]);
		}
		printf("\n");
	}
}
